Reject static item as direct const generic arg#158479
Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? @BoxyUwU |
|
|
This comment has been minimized.
This comment has been minimized.
… with static value namespace
67f73a3 to
c5de45f
Compare
|
sry for taking so long to get to this, thanks for looking into this ICE ✨ This probably merge conflicts with #158617, but more usefully it'd theoretically also let us fallback to an anon const instead of erroring if we wish 🤔 though i think for now i'd like to hold off on making the i think I would prefer for us to not handle special case statics during ast lowering in any way, and instead error during HIR ty lowering when encountering a static 🤔 im not sure I understand why I feel this way 😅 we do already have some semantic checks in HIR ty lowering about what kind of thing we resolved to (e.g. type const or non type const) so I think it just feels like we do our semantic checks there and syntactic checks in ast lowering. can you emit these errors in HIR ty lowering instead :3 |
| let msg = "complex const arguments must be placed inside of a `const` block"; | ||
| hir::ConstArgKind::Error(self.dcx().struct_span_err(span, msg).emit()) | ||
| } else if is_trivial_path || tcx.features().min_generic_const_args() { | ||
| let qpath = self.lower_qpath( |
There was a problem hiding this comment.
cc @khyperia i don't think we handled this codepath in your PR overhauling ast lowering for mgca. we should probably be checking can_lower_to_direct_const_arg here and then also reusing the lower_expr_to_direct logic here? though it would really just be the path arms right now but still... seems nice for consistency/sharing logic 🤔
unrelated to this PR, just something i realised while reading this
There was a problem hiding this comment.
yus, the logic here happens to be identical even with the syntax flip PR, but, it's a very wishy-washy "happens to be correct" and you're absolutely right that these should share a codepath so they don't accidentally diverge
|
@rustbot author |
closes: #136139
This PR fixes the ICE and not add support for static in MGCA